package com.jugheadzhou.core.message.rabbitmq.producer.callback;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ReturnedMessage;
import org.springframework.amqp.rabbit.core.RabbitTemplate;

/**
 * 发生异常时的消息返回提醒
 *
 * @author jugheadzhou
 * @date 2021-12-03
 */
@Slf4j
public class RabbitDefaultReturnCallback implements RabbitTemplate.ReturnsCallback {

    /**
     * Returned message callback.
     *
     * @param returned the returned message and metadata.
     */
    @Override
    public void returnedMessage(ReturnedMessage returned) {
        log.error("消息发送异常返回内容：{}", returned.toString());
    }

}